//
//  OuptPrescribeCell.m
//  掌上宏力
//
//  Created by admin on 2017/5/8.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "OuptPrescribeCell.h"

static CGFloat Lab_H = 30;
static CGFloat Lab_W = 65;
static CGFloat TextFont = 15;
static CGFloat LabFont = 14;


@interface OuptPrescribeCell ()
/*
 //药品名称 DRUG_NAME
 @property (nonatomic,copy) NSString *drugName;
 //数量 AMOUNT
 @property (nonatomic,copy) NSString *amount;
 //单位 UNITS
 @property (nonatomic,copy) NSString *units;
 //服用方法 ADMINISTRATION
 @property (nonatomic,copy) NSString *method;
 //间隔次数(如：一日三次) FREQUENCY
 @property (nonatomic,copy) NSString *frequency;
 */
@property (nonatomic,weak) UILabel *methodT;
@property (nonatomic,weak) UILabel *frequencyT;

@end

@implementation OuptPrescribeCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        //服用方法 labW+textW+leftDis
        UILabel *methodL = [Factory createLabelWithTitle:@"服用方法:" frame:CGRectMake(LeftDis, 5, Lab_W, Lab_H) fontSize:LabFont];
        [self.contentView addSubview:methodL];

        UILabel *methodT = [self createLabelWithFrame:CGRectMake(methodL.right, 5, Lab_W+20, Lab_H)];
        self.methodT = methodT;
        //间隔次数
        UILabel *frequencyL = [Factory createLabelWithTitle:@"间隔次数:" frame:CGRectMake(kScreenW-LeftDis-Lab_W*2-20, 5, Lab_W, Lab_H) fontSize:LabFont];
        [self.contentView addSubview:frequencyL];
        UILabel *frequencyT = [self createLabelWithFrame:CGRectMake(frequencyL.right, 5, Lab_W+20, Lab_H)];
        self.frequencyT = frequencyT;
        
    }
    return self;
}

-(void)setPrescribeModel:(OuptPrescribeModel *)prescribeModel{
    self.methodT.text =  prescribeModel.method;
    self.frequencyT.text = prescribeModel.frequency;
}
-(UILabel *)createLabelWithFrame:(CGRect)frame{
    UILabel *lab = [[UILabel alloc] initWithFrame:frame];
    lab.textAlignment = NSTextAlignmentLeft;
    lab.font = kFont(TextFont);
    [self.contentView addSubview:lab];
    return lab;
}
+(instancetype)cellWithTableView:(UITableView *)tableView{
    static NSString *Id = @"prescribeCell";
    OuptPrescribeCell *cell = [tableView dequeueReusableCellWithIdentifier:Id];
    if (cell == nil) {
        cell = [[OuptPrescribeCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Id];
    }
    return cell;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
